Hello everyone,
I’m running into persistent errors in Stata when using very simple code blocks that involve
loops or
. Despite the code being minimal and apparently correct, I keep getting messages such as:
I get:
However, this code works fine (all on a single line for Mata):
But in my real code, I have a lot of Mata lines in that block. I’d like to do something like:
right in the middle of my while { ... } loop.
I’m running into persistent errors in Stata when using very simple code blocks that involve
Code:
while { ... }
Code:
program define ... mata: ... end ... end
Code:
cap program drop test_minimal program test_minimal version 18.0 local a 1 while (`a'<2) { mata: real matrix mymat = J(1,1,123) end local a = `a' + 1 } end test_minimal
Code:
} is not a valid command name r(199);
Code:
cap program drop test_minimal program test_minimal version 18.0 local a 1 while (`a'<2) { mata: real matrix mymat = J(1,1,123) local a = `a' + 1 } end test_minimal
Code:
mata: <many lines of Mata code> end
Comment